<template>
  <div class="modal-bg" v-show="show">
    <div
      id="modal-container"
      :class="[show ? 'dialogShow' : 'dialogClose']"
    >
      <div class="modal-header" :title="title">
        {{ title}}
        <i class="fa fa-remove" aria-hidden="true" @click="cancel"></i>
      </div>
      <slot></slot>
      <!-- <div class="modal-main">
        <div class="box">
          <label for="sex">性别</label>
          <select id="sex">
            <option>男</option>
            <option>女</option>
          </select>
          <i class="fa fa-remove" aria-hidden="true"></i>
        </div>
        <div class="box">
          <label for="">角色Key</label>
          <input type="text" />
        </div>
        <div class="box">
          <label for="">部门名</label>
          <input type="text" />
        </div>
      </div> -->
      <!-- <div class="modal-footer">
        <button @click="submit">保存</button>
      </div> -->
    </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "IDialog",
  props: {
    show: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default: ""
    }
  },
  data() {
    return {};
  },
  mounted() {},
  methods: {
    cancel() {
      this.$emit("cancel");
    },
  }
};
</script>


<style lang="less" scoped>
.dialogShow {
  animation: dialogStart 0.3s;
  animation-fill-mode: both;
}
@keyframes dialogStart {
  0% {
    transform: scale(0.2);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.dialogClose {
  animation: dialogEnd 0.5s;
  animation-fill-mode: both;
}
@keyframes dialogEnd {
  0% {
    transform: scale(1);
    opacity: 0;
  }
  100% {
    transform: scale(0.2);
    opacity: 1;
  }
}
.modal-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(34, 34, 34, 0.5);
  z-index: 10;

  #modal-container {
    background: #37404a;
    width: 40rem;
    height: 20rem;
    border-radius: 0.3125rem;
    overflow: hidden;
    position: fixed;
    top: 20%;
    left: 38%;

    .modal-header {
      height: 2.8125rem;
      display: flex;
      align-items: center;
      padding: 0 0.9375rem;
      box-sizing: border-box;
      font-size: 0.9375rem;
      border-bottom: 0.1px solid rgb(118, 125, 134);
      i {
        position: absolute;
        right: 1.75rem;
        color: #b0a2a6;
        font-size: 1rem;
      }
    }
    .modal-main {
      padding: 0;
      display: flex;
      flex-direction: column;

      .box {
        width: 100%;
        margin: 1.125rem 0;
        display: flex;
        align-items: center;
        .vue-treeselect {
          width: 26.3125rem;
        }
        label {
          display: inline-block;
          text-align: end;
          width: 5rem;
          margin-right: 0.5rem;
          font-size: 0.875rem;
        }
        select,
        input {
          width: 26.25rem;
          height: 1.875rem;
          background: #37404a;
          color: #fff;
          border: 0.1px solid rgb(118, 125, 134);
          border-radius: 5px;
          padding-left: 15px;
          box-sizing: border-box;
        }
        input:hover,
        input:focus {
          border: 0.1px solid #4baa4e;
        }
        i {
          position: relative;
          left: -2.5rem;
        }
      }
    }

    .modal-footer {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 3.125rem;
      position: fixed;
      bottom: 0.1875rem;
      button {
        width: 21.875rem;
        background-color: #4baa4e;
        height: 1.875rem;
        border-radius: 5px;
        color: #fff;
      }
    }
  }
}
</style>
